package www.dianbaozu.com.ui.server

import com.chad.library.adapter.base.BaseNodeAdapter
import com.chad.library.adapter.base.entity.node.BaseNode
import com.chad.library.adapter.base.module.LoadMoreModule
import www.dianbaozu.com.R
import www.wen.com.common.lib.data.entities.ServerGroupEntity

/**
 * @author WEN
 * @Description:首页-服务 右边的分组列表 的Adapter
 * @date 2020//25 17:48
 */

class ServerListAdapter(ownUserId: String): BaseNodeAdapter(), LoadMoreModule {

    init {
        addNodeProvider(ServerListFirstProvider(ownUserId))
        addNodeProvider(ServerListSecondProvider())
        addChildClickViewIds(R.id.channel, R.id.ivAdd)
        addChildLongClickViewIds(R.id.group)
    }

    override fun getItemType(data: List<BaseNode>, position: Int): Int{
        val node = data[position]
        if (node is ServerGroupEntity.Content) {
            return 1
        } else if (node is ServerGroupEntity.Content.ChannelVO) {
            return 2
        }
        return -1
    }

}

